#!/bin/sh
# build go
go build main.go
echo "build is success"
# 杀进程
pid=`ps aux | grep main | grep -v grep | cut -d " " -f 7`
if [ $pid -eq ""]
then
   pid=`ps aux | grep main | grep -v grep | cut -d " " -f 6`
fi
# kill
kill -9 $pid
echo "kill -9 $pid is success"
nohup ./main &
echo "restart is success"